import request from '@/utils/request'

// 查询通道门设置列表
export function listDoor(query) {
  return request({
    url: '/system/door/list',
    method: 'get',
    params: query
  })
}

// 查询通道门设置详细
export function getDoor(id) {
  return request({
    url: '/system/door/' + id,
    method: 'get'
  })
}

// 新增通道门设置
export function addDoor(data) {
  return request({
    url: '/system/door',
    method: 'post',
    data: data
  })
}
 // 查询用于存储仓库信息的列表
 export function listWarehouse() {
 	var data = {
 		pageNum: 1,
 		pageSize: 10000,
 	}
   return request({
     url: '/system/warehouse/list',
     method: 'get',
     params: data
   })
 }
// 修改通道门设置
export function updateDoor(data) {
  return request({
    url: '/system/door',
    method: 'put',
    data: data
  })
}

// 删除通道门设置
export function delDoor(id) {
  return request({
    url: '/system/door/' + id,
    method: 'delete'
  })
}
// 连接通道门
export function connectDoor(ip,url) {
  return request({
    url: '/api/discrete/tcpClientTdmOn?ip='+ip+"&url="+url,
    method: 'get'
  })
}
// 断开通道门
export function closeDoor(ip,url) {
  return request({
    url: '/api/discrete/tcpClientTdmOff?ip='+ip+"&url="+url,
    method: 'get'
  })
}